import request from '../index';
import {ApiResponse} from '../types';
import type {TableItemType} from './types';

// 获取表总数
function getCount(key:string|null){
    const url="/yiqing/count";
    const method="get";
    return request<number>(url,method,{key});
}

// 根据条件获得的相应的展示数据
function getPageData(current:number,size:number,key:string|null){
    const url="/yiqing/list";
    const method="get";
    return request<Array<TableItemType>>(url,method,{current,size,key})
}

// 添加或者修改疫情数据
function addYiQing(data:TableItemType){
    const url="/yiqing/add";
    const method="post";
    return request<boolean>(url,method,data);
}

// 删除一个疫情数据
function deleteYiQing(id:number){
    const url="yiqing/delete/"+id;
    const method="delete";
    return request<boolean>(url,method);
}

export {getCount,getPageData,addYiQing,deleteYiQing}